package com.nhom4.ADP;

public class TestFraction {

	public void test1() {
		System.out.println("\nTest 1");
		Fraction f1 = new Fraction(1, 2);
		Fraction f2 = new Fraction(3, 4);

		Fraction f3 = new Fraction();

		f3.plus(f1, f2);
		System.out.println("f1 + f2 = " + f3.output());

		f3.subtract(f1, f2);
		System.out.println("f1 - f2 = " + f3.output());

		f3.multiply(f1, f2);
		System.out.println("f1 * f2 = " + f3.output());

		f3.divided(f1, f2);
		System.out.println("f1 / f2 = " + f3.output());

	}

	public void test2() {
		System.out.println("\nTest 2");
		Fraction f1 = new Fraction(-1, 2);
		Fraction f2 = new Fraction(3, 4);

		Fraction f3 = new Fraction();

		f3.plus(f1, f2);
		System.out.println("f1 + f2 = " + f3.output());

		f3.subtract(f1, f2);
		System.out.println("f1 - f2 = " + f3.output());

		f3.multiply(f1, f2);
		System.out.println("f1 * f2 = " + f3.output());

		f3.divided(f1, f2);
		System.out.println("f1 / f2 = " + f3.output());

	}

	public void test3() {
		System.out.println("\nTest 3");
		Fraction f1 = new Fraction(-1, 2);
		Fraction f2 = new Fraction(-3, 4);

		Fraction f3 = new Fraction();

		f3.plus(f1, f2);
		System.out.println("f1 + f2 = " + f3.output());

		f3.subtract(f1, f2);
		System.out.println("f1 - f2 = " + f3.output());

		f3.multiply(f1, f2);
		System.out.println("f1 * f2 = " + f3.output());

		/*
		 * f3.divided(f1, f2); System.out.println("f1 / f2 = " + f3.output());
		 */
	}

	public void test4() {
		System.out.println("\nTest 4");
		Fraction f1 = new Fraction(0, 2);
		Fraction f2 = new Fraction(3, 4);

		Fraction f3 = new Fraction();

		f3.plus(f1, f2);
		System.out.println("f1 + f2 = " + f3.output());

		/*
		 * f3.subtract(f1, f2); System.out.println("f1 - f2 = " + f3.output());
		 */
		f3.multiply(f1, f2);
		System.out.println("f1 * f2 = " + f3.output());

		f3.divided(f1, f2);
		System.out.println("f1 / f2 = " + f3.output());

	}

	public void test5() {
		System.out.println("\nTest 5");
		Fraction f1 = new Fraction(0, 2);
		Fraction f2 = new Fraction(0, 4);

		Fraction f3 = new Fraction();

		f3.plus(f1, f2);
		System.out.println("f1 + f2 = " + f3.output());

		f3.subtract(f1, f2);
		System.out.println("f1 - f2 = " + f3.output());

		f3.multiply(f1, f2);
		System.out.println("f1 * f2 = " + f3.output());

		f3.divided(f1, f2);
		System.out.println("f1 / f2 = " + f3.output());

	}

	public void test6() {
		System.out.println("\nTest 6");
		Fraction f1 = new Fraction(0, 2);
		Fraction f2 = new Fraction(3, 0);

		Fraction f3 = new Fraction();

		f3.plus(f1, f2);
		System.out.println("f1 + f2 = " + f3.output());

		f3.subtract(f1, f2);
		System.out.println("f1 - f2 = " + f3.output());

		f3.multiply(f1, f2);
		System.out.println("f1 * f2 = " + f3.output());

		f3.divided(f1, f2);
		System.out.println("f1 / f2 = " + f3.output());

	}

	public static void main(String[] args) {
		TestFraction f = new TestFraction();
		f.test1();
		f.test2();
		f.test3();
		f.test4();
		f.test5();
		f.test6();
	}
}
